/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.knowledge.facts;

import com.environment.Tile;

/**
 *
 * @author keithballantyne
 */
public abstract class Fact {
    protected Tile location;
    
    // note that using location means that for the life of a fact in the repository
    // the location may not change, otherwise we violate the immutable part of the
    // hashCode and equals clauses in the contract.
    @Override
    public int hashCode() {
        return location.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Fact other = (Fact) obj;
        
        return (this.location.hashCode() == other.location.hashCode());
    }
        
    public Tile getLocation() {
        return location;
    }

    public abstract String getName();
}
